/*
* 异步组件
*/
// 登录页面
const Login = r => require.ensure([], () => r(require('./views/Login')), 'Login')
// 404页面
const NotFound = r => require.ensure([], () => r(require('./views/404.vue')), 'NotFound')
// home页
const Home = r => require.ensure([], () => r(require('./views/Home.vue')), 'Home')
// 首页
const Index = r => require.ensure([], () => r(require('./views/Index.vue')), 'Index')
// 用户列表页面
const UserList = r => require.ensure([], () => r(require('./views/user/UserList.vue')), 'UserList')
// 用户详情页
const User = r => require.ensure([], () => r(require('./views/user/User.vue')), 'User')
// 品牌
const BrandList = r => require.ensure([], () => r(require('./views/product/BrandList.vue')), 'BrandList')
// 商品分类
const ClassifyManage = r => require.ensure([], () => r(require('./views/product/ClassifyManage.vue')), 'ClassifyManage')
// 新增商品
const AddProduct = r => require.ensure([], () => r(require('./views/product/Add.vue')), 'AddProduct')
// 商品列表
const ProductList = r => require.ensure([], () => r(require('./views/product/ProductList.vue')), 'ProductList')
// 商品详情
const ProductDetail = r => require.ensure([], () => r(require('./views/product/Details.vue')), 'ProductDetail')
// 管理员操作日志
const ActionLog = r => require.ensure([], () => r(require('./views/admin/ActionLog.vue')), 'ActionLog')
// 管理员登陆日志
const LoginLog = r => require.ensure([], () => r(require('./views/admin/LoginLog.vue')), 'LoginLog')
// 商品规格
const ProductOption = r => require.ensure([], () => r(require('./views/product/Option.vue')), 'ProductOption')
// 商品参数
const ProductParams = r => require.ensure([], () => r(require('./views/product/Parameter.vue')), 'ProductParams')
// 卡劵管理
const CardList = r => require.ensure([], () => r(require('./views/product/CardList.vue')), 'CardList')
// 商品评论
const CommentList = r => require.ensure([], () => r(require('./views/product/CommentList.vue')), 'CommentList')
// 微信广告
const Advert = r => require.ensure([], () => r(require('./views/advert/wechatAdvertisement.vue')), 'Advert')
// 编辑微信广告
const EditAdvert = r => require.ensure([], () => r(require('./views/advert/EditAdvert.vue')), 'EditAdvert')
// 添加微信广告
const AddAdvert = r => require.ensure([], () => r(require('./views/advert/AddAdvert.vue')), 'AddAdvert')
// 运费设置
const Freight = r => require.ensure([], () => r(require('./views/product/Freight.vue')), 'Freight')
// 物流设置
const ExpressCompany = r => require.ensure([], () => r(require('./views/product/ExpressCompany.vue')), 'ExpressCompany')

// 参数设置
const Setting = r => require.ensure([], () => r(require('./views/system/Setting.vue')), 'Setting')
// 参数设置
const storeSetting = r => require.ensure([], () => r(require('./views/order/storeSetting.vue')), 'storeSetting')
//  支付方式设置
const Payment = r => require.ensure([], () => r(require('./views/system/Payment.vue')), 'Payment')

// 国家设置
const CountrySetting = r => require.ensure([], () => r(require('./views/system/CountrySetting.vue')), 'CountrySetting')
// 缓存页面
const Cache = r => require.ensure([], () => r(require('./views/system/Cache.vue')), 'Cache')
// 订单设置
const OrderSetting = r => require.ensure([], () => r(require('./views/order/OrderSetting.vue')), 'OrderSetting')
// 订单列表
const OrderList = r => require.ensure([], () => r(require('./views/order/OrderList.vue')), 'OrderList')
// 订单详情页
const OrderDetails = r => require.ensure([], () => r(require('./views/order/Details.vue')), 'OrderDetails')

// 微信自动回复
const WeChatReply = r => require.ensure([], () => r(require('./views/wechat/reply.vue')), 'WeChatReply')
// 微信菜单
const WeChatMenu = r => require.ensure([], () => r(require('./views/wechat/menu.vue')), 'WeChatMenu')

// 微信素材
const WeChatMedia = r => require.ensure([], () => r(require('./views/wechat/media.vue')), 'WeChatMedia')
// 退货退款
const Refund = r => require.ensure([], () => r(require('./views/order/Refund.vue')), 'Refund')
// 退货退款详情
const RefundDetail = r => require.ensure([], () => r(require('./views/order/RefundDetail.vue')), 'RefundDetail')
// 优惠劵列表
const CouponList = r => require.ensure([], () => r(require('./views/marketing/CouponList.vue')), 'CouponList')
// 新增优惠劵
const AddCoupon = r => require.ensure([], () => r(require('./views/marketing/AddCoupon.vue')), 'AddCoupon')
// 编辑优惠劵
const EditCoupon = r => require.ensure([], () => r(require('./views/marketing/EditCoupon.vue')), 'EditCoupon')
// 管理员列表
const AdminList = r => require.ensure([], () => r(require('./views/admin/List.vue')), 'AdminList');
// 权限组列表
const RoleList = r => require.ensure([], () => r(require('./views/admin/RoleList.vue')), 'RoleList');

let routes = [
  {
    path: '/login',
    component: Login,
    name: '',
    hidden: true
  },
  {
    path: '/404',
    component: NotFound,
    name: '',
    hidden: true
  },
  {
    path: '/index',
    component: Home,
    name: '首页',
    iconCls: 'fa fa-home',
    leaf: true, // 只有一个节点
    children: [
      {path: '/index', component: Index, name: '首页'}
    ]
  },
  {
    path: '/',
    component: Home,
    name: '用户管理',
    iconCls: 'fa fa-address-book-o', // 图标样式class
    children: [
      {path: '/users', component: UserList, name: '普通用户'},
      {path: '/users/:id', component: User, name: '用户详情', hidden: true}
    ]
  },

  {
    path: '/',
    component: Home,
    name: '订单管理',
    iconCls: 'fa fa-list-ul',
    children: [
        {path: '/order/setting', component: OrderSetting, name: '订单设置'},
        {path: '/order/list', component: OrderList, name: '订单列表'},
        {path: '/order/list/detail/:id', component: OrderDetails, name: '订单详情', hidden: true},
        {path: '/order/refund', component: Refund, name: '退货退款'},
        {path: '/order/refund/:id', component: RefundDetail, name: '退款、退货详情', hidden: true}
    ]
  },
  {
    path: '/',
    component: Home,
    name: '商品管理',
    iconCls: 'fa fa-shopping-bag',
    children: [
      {path: '/product/brand', component: BrandList, name: '品牌管理'},
      {path: '/product/category', component: ClassifyManage, name: '分类管理'},
      {path: '/product/list', component: ProductList, name: '商品列表'},
      {path: '/product/list/add', component: AddProduct, name: '新增商品', hidden: true},
      {path: '/product/list/detail/:id', component: ProductDetail, name: '商品详情', hidden: true},
      {path: '/product/option', component: ProductOption, name: '商品规格'},
      {path: '/product/params', component: ProductParams, name: '商品参数'},
      {path: '/product/card-list', component: CardList, name: '卡券管理'},
      {path: '/comment-list', component: CommentList, name: '商品评价'},
      {path: '/freight', component: Freight, name: '运费设置'}
    ]
  },
  // {
  //   path: '/',
  //   component: Home,
  //   name: '售后管理',
  //   iconCls: 'fa fa-handshake-o',
  //   // leaf: true,//只有一个节点
  //   children: [
  //
  //   ]
  // },
  // {
  //   path: '/',
  //   component: Home,
  //   name: '卡包管理',
  //   iconCls: 'fa fa-credit-card',
  //   children: [
  //
  //   ]
  // },
  // {
  //   path: '/',
  //   component: Home,
  //   name: '充值管理',
  //   iconCls: 'fa fa-cny',
  //   children: [
  //
  //   ]
  // },
  {
    path: '/',
    component: Home,
    name: '市场营销',
    iconCls: 'fa fa-share-square-o',
    children: [
      {path: '/marketing/coupon', component: CouponList, name: '优惠券'},
      {path: '/marketing/coupon/add-coupon', component: AddCoupon, name: '新增优惠券', hidden: true},
      {path: '/marketing/coupon/edit-coupon/:id', component: EditCoupon, name: '编辑优惠券', hidden: true}
    ]
  },
  // {
  //   path: '/',
  //   component: Home,
  //   name: '营销活动',
  //   iconCls: 'fa fa-share-alt-square',
  //   children: [
  //
  //   ]
  // },
  {
    path: '/',
    component: Home,
    name: '广告管理',
    iconCls: 'fa fa-share-alt-square',
    children: [
       {path: '/wechat/advert', component: Advert, name: '移动端广告'},
       {path: '/wechat/add-advert', component: AddAdvert, name: '新增广告', hidden: true},
       {path: '/wechat/edit-advert/:id', component: EditAdvert, name: '编辑广告', hidden: true}
    ]
  },
  {
    path: '/',
    component: Home,
    name: '系统设置',
    iconCls: 'fa fa-cog',
    children: [
      {path: '/settings', component: Setting, name: '第三方参数'},
      {path: '/storeSetting', component: storeSetting, name: '商城设置'},
      {path: '/payment', component: Payment, name: '支付方式'},
      {path: '/express-company', component: ExpressCompany, name: '快递设置'},
      {path: '/countrySetting', component: CountrySetting, name: '国家设置'},
      {path: '/system/cache', component: Cache, name: '缓存清理'}
    ]
  },
  {
    path: '/',
    component: Home,
    name: '微信设置',
    iconCls: 'fa fa-cog',
    children: [
      {path: '/wechat/reply', component: WeChatReply, name: '自动回复'},
      {path: '/wechat/menu', component: WeChatMenu, name: '公众号菜单'},
      {path: '/wechat/media', component: WeChatMedia, name: '回复素材'}
    ]
  },
  {
    path: '/',
    component: Home,
    name: '管理员',
    iconCls: 'fa fa-cog',
    children: [
      {path: '/admin/List', component: AdminList, name: '管理员列表'},
      {path: '/admin/action', component: ActionLog, name: '操作日志'},
      {path: '/admin/login', component: LoginLog, name: '登陆日志'},
      {path: '/admin/roles', component: RoleList, name: '权限组'}
    ]
  },
  {
    path: '*',
    hidden: true,
    redirect: {path: '/404'}
  }
]

export default routes
